package EDesign23;

public class EAdapter {

    public  class  TwoThousandSignal {}
    public  class  FourThousandSignal {}



    public class Player {
        public TwoThousandSignal play() {
            return new TwoThousandSignal();
        }
    }


    public interface ModernPlayer {
        FourThousandSignal play();
    }

    public class ModernPlayerAdapter implements ModernPlayer {

        private Player player = new Player();

        @Override
        public FourThousandSignal play() {
            TwoThousandSignal twoThousandSignal = player.play();
            return convertToFourThousandSignal(twoThousandSignal);
        }

        private FourThousandSignal convertToFourThousandSignal(TwoThousandSignal twoThousandSignal) {
            //4k信号通过算法计算，从2k转换而来。省略转换逻辑，
            return new FourThousandSignal();
        }
    }

    public class Television {
        private ModernPlayer modernPlayer = new ModernPlayerAdapter();

        public void display(){
            modernPlayer.play();
        }
    }



}
